﻿<div class="form-horizontal" ms-controller="RCTX">
    <!--<div class="form-group">
        <label class="col-xs-2 control-label">任务状态</label>
        <div class="col-xs-4">
            <select class="form-control" ms-duplex="modelData.RWStatus">
                <option value="0" ms-attr-selected="modelData.RWStatus=='0'?'selected':''">正在进行</option>
                <option value="1" ms-attr-selected="modelData.RWStatus=='1'?'selected':''">已结束</option>
            </select>
        </div>
    </div>-->
    <div class="form-group">
        <label class="col-xs-2 control-label">任务类型</label>
        <div class="col-xs-4">
            <select class="form-control" ms-duplex="modelData.LeiBie">
                <option ms-attr-selected="modelData.LeiBie=='一般'">一般</option>
                <option ms-attr-selected="modelData.LeiBie=='重要'">重要</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">任务内容</label>
        <div class="col-xs-9">
            <textarea class="form-control   szhl_require szhl_UEEDIT"  id="conRW" ms-duplex="modelData.RWTitle" autofocus="autofocus"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">任务截止时间</label>
        <div class="col-xs-5">
            <input class="szhl_form_date form-control " ms-duplex="modelData.RWJZDate" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">负责人</label>
        <div class="col-xs-9">
            <input type="text" class="form-control szhl_getPeoples szhl_require" signle="Y" ms-duplex="modelData.RWFZR" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">参与人</label>
        <div class="col-xs-9">
            <input type="text" class="form-control szhl_getPeoples   szhl_require" ms-duplex="modelData.RWCYR">
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">附件</label>
        <div class="col-xs-9">
            <input type="text" class="szhl_Upload form-control" ms-duplex="modelData.Files"/>
        </div>
    </div>
</div>
<script> 
    var tempmodel = avalon.define({
        $id: "RCTX",
        name: "任务管理",
        modelData: (!pmodel.pageType && localStorage.getItem(pmodel.FormCode)) ? $.parseJSON(localStorage.getItem(pmodel.FormCode)) : { "RWStatus": "0", "LeiBie": "一般", "RWTitle": "", "RWJZDate": "", "RWFZR": ComFunJS.getnowuser(), "RWCYR": "", "TopID": "","Files":""},
        iswf: false,//是否属于流程表单
        inittemp: function (strId) {
            if (strId) {
                //编辑加载数据
                $.getJSON('/API/FTAPI.ashx?Action=GETRCTXMODEL', { P1: strId }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        tempmodel.modelData = resultData.Result;
                        if (tempmodel.modelData.RWJZDate && tempmodel.modelData.RWJZDate.length > 10) {
                            tempmodel.modelData.RWJZDate = tempmodel.modelData.RWJZDate.substring(0, 10);
                        }

                        setTimeout(" ComFunJS.initForm()", 500)
                    }
                })
            } else {
                ComFunJS.initForm()
            }
            tempmodel.modelData.TopID = ComFunJS.getQueryString("TopID", "0");
        },//初始化
        SaveData: function (btdom, piid) {
            var data = tempmodel.modelData.$model;
            var modelValue = JSON.stringify(data);
            $.post("/API/FTAPI.ashx?ACTION=ADDRCTX", { P1: modelValue }, function (result) {
                var jsonresult = $.parseJSON(result)
                btdom.removeClass("disabled").find("i").hide();
                if ($.trim(jsonresult.ErrorMsg) == "") {
                    ComFunJS.winsuccessnew("操作成功");
                }
            });
        },
    });
    tempmodel.$watch("modelData.*", function (a, b) {
        if (!tempmodel.modelData.ID) {
            localStorage.setItem(pmodel.FormCode, JSON.stringify(tempmodel.modelData.$model));
        }
    })
    //@ sourceURL=RCTX.js;
</script>